package cn.edu.java.io.reader;

import java.io.CharArrayReader;
import java.io.IOException;
import java.io.Reader;

public class CharArrayReaderDemo {
    public static void main(String[] args) {
        char[] charArray = {'H', 'e', 'l', 'l', 'o', ',', '中', '国'};

        try (Reader reader = new CharArrayReader(charArray)) {
            int data;
            while ((data = reader.read()) != -1) {
                char character = (char) data;
                System.out.print(character);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

